package com.mathmodeling.repository;

import com.mathmodeling.entity.Contest;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.time.LocalDate;
import java.util.List;

@Repository
public interface ContestRepository extends JpaRepository<Contest, String> {
    
    /**
     * 查找当前正在进行的竞赛
     */
    List<Contest> findByStartTimeLessThanEqualAndEndTimeGreaterThanEqual(
            LocalDate startDate, LocalDate endDate);
    
    /**
     * 查找已结束的竞赛
     */
    List<Contest> findByEndTimeBefore(LocalDate currentDate);
    
    /**
     * 查找即将开始的竞赛
     */
    List<Contest> findByStartTimeAfter(LocalDate currentDate);
} 